#include <iostream>
using namespace std;

class Solution {
public:
    bool isPerfectSquare(int num) {
        int low = 0;
        int high = num;
        int res = -1;
        while(low <= high){
            int mid = (low + high) / 2;
            if((long long)mid * mid <= num)
            {
                res = mid;
                low = mid + 1;
            }
            else high = mid - 1;
        }
        if((long long)res * res == num) return true;
        return false;
    }
};

int main()
{
    Solution sol;
    cout << sol.isPerfectSquare(16) << endl;
    return 0;
}